import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Home from "@/views/Home.vue";
import Index from "@/views/Index.vue";
import User1 from "@/views/user/User-1.vue";
import User2 from "@/views/user/User-2.vue";
Vue.use(VueRouter)

const routes = [
  {
     path: '/home',
     name: '首页',
    component: Home
  },
  {
    path: '/',
    name: '用户管理',
    component: Index,
     children:[
       {
          path: '/user-1',
          name: '新增用户',
          component: User1
       },
       {
         path: '/user-2',
         name: '修改用户',
         component: User2
       }
     ]
  },
  {
    path: '/about',
    name: '关于',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
